package com.mftour.moudles.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;

import com.mftour.moudles.entity.User;
import com.mftour.moudles.mapper.UserMapper;
import com.mftour.moudles.service.UserService;

@Service("userService")
public class UserServiceImpl extends BaseServiceImpl<User, Integer> implements UserService {
	@Autowired
	UserMapper userMapper;

	@Override
	public List<User> getUsersByRoleId(Integer roleId) {
		return userMapper.getUsersByRoleId(roleId);
	}

	@Override
	public void insertSelectiveException(User record) {
		userMapper.insertSelective(record);
	}
	
	@Override
	public boolean insertSelectiveManual(User record) {
		try {
			// genratePk(record);
			baseMapper.insertSelective(record);
		} catch (Exception e) {
			e.printStackTrace();
			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
			return false;
		}
		return true;
	}
}